package org.bonorsoft.modules.control.mapper;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bonorsoft.modules.control.entity.Places;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.bonorsoft.modules.control.vo.PlacesVo;

import java.util.List;

/**
 * @Description: 四闲场所
 * @Author: WilliamYe
 * @Date:   2021-04-16
 * @Version: V1.0
 */
public interface PlacesMapper extends BaseMapper<Places> {

    @Select("SELECT ywlsh,dzbm,dzmc,fz_xm,fz_gmsfhm,fz_lxdh,syxs,fwlbdm,fwytdm,fwgljb,fwcqxzzldm,fwmj_mjpfm,fwjs,fwtg,sspcs,ssmj_zh,ssmj_xm,SSSQJWWG_DZBM,WGY_XM,GQFZR_XM,SQJWH,JZMC,MPH,DZWZ,DZSFCZ,DZSFZY," +
            "(select photo_path from police_sxcs_photo where police_sxcs_photo.places_id = ybss_sx_sxcs.ywlsh) as photo " +
            "FROM ybss_sx_sxcs ${ew.customSqlSegment}")
    IPage<PlacesVo> paging(Page<Places> page, @Param(Constants.WRAPPER) QueryWrapper<Places> queryWrapper);

    @Select("SELECT ywlsh,dzbm,dzmc,fz_xm,fz_gmsfhm,fz_lxdh,syxs,fwlbdm,fwytdm,fwgljb,fwcqxzzldm,fwmj_mjpfm,fwjs,fwtg,sspcs,ssmj_zh,ssmj_xm,SSSQJWWG_DZBM,WGY_XM,GQFZR_XM,SQJWH,JZMC,MPH,DZWZ,DZSFCZ,DZSFZY," +
            "(select photo_path from police_sxcs_photo where police_sxcs_photo.places_id = ybss_sx_sxcs.ywlsh) as photo " +
            "FROM ybss_sx_sxcs ${ew.customSqlSegment}")
    List<PlacesVo> listing(@Param(Constants.WRAPPER) QueryWrapper<Places> queryWrapper);

    int saveBatchPhoto(List<PlacesVo> list);
}
